#ifndef SCREENPRESENTATION_H
#define SCREENPRESENTATION_H

#include <QWidget>
#include <QGraphicsScene>
#include "LedView.h"
#include "ScreenView.h"

namespace Ui {
class ScreenPresentation;
}

class ScreenPresentation : public QWidget
{
	Q_OBJECT

	QGraphicsScene scene;

	void initScene();

	void updateLeds(QList<LedStripe> stripes);

	int _ledsW, _ledsH;
	int _ledsCount;

	QList<LedView*> _ledsList;
	ScreenView* _screenView;
	bool _CW;
	int _startIndex;

	bool _selectable;

	bool reloadLeds();

	// obsolete
	//void updateLeds(QRectF rect);
	//int posToCount(int x, int y, bool CW);
	//QPoint countToPos(int cnt, bool CW);

	
public:
	explicit ScreenPresentation(QWidget *parent = 0);
	~ScreenPresentation();

	void setLedsCount(int x, int y = -1);
	QList<LedView*> getLeds();
	void update1();
	void setDirection(bool clockwise);
	void setStartLed(LedView* led);
	void updateStartLed();
    QRectF getScreenRect() {return _screenView->boundingRect();}
    int getScreenNumber(){return _screenView->getScreenNumber();}
    void setScreenNumber(int num){_screenView->setScreenNumber(num);}
	void setMode(ScreenMode::Enum mode){_screenView->setMode(mode);}
	void showScreenShots(bool show){_screenView->showScreenShots(show);}
	void setSelectable(bool sel){_selectable = sel;}
	bool selectable(){return _selectable;}
	
private:
	Ui::ScreenPresentation *ui;

protected:
	void resizeEvent(QResizeEvent * event);
};

#endif // SCREENPRESENTATION_H
